@Repository
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th=
        "http://www.thymeleaf.org" lang="en">
<head th:replace="fragments/header :: head">
</head>
<body>
<div th:replace="fragments/header :: navbar"></div>
<div th:fragment="bookForm" class="container">
    <div class="row justify-content-center">
        <div class="col-6">
            <div class="alert alert-success" th:if="${successMessage}"
                 th:utext="${successMessage}">
            </div>
            <form name="form" role="form" th:action="@{/registration}"
                  th:object="${user}" method="post">
                <div class="form-group">
                    <label class="form-control-label" for="login">用户名
                    </label>
                    <input type="text" class="form-control" id="login"
                           name="login"
                           th:field="*{userName}" required
                           minlength="1" maxlength="50"
                           pattern="^[_'.@A-Za-z0-9-]*$">
                    <div th:if="${#fields.hasErrors('userName')}">
                        <small class="form-text text-danger"
                               th:errors="*{userName}">
                        </small>
                    </div>
                </div>
                <div class="form-group">
                    <label class="form-control-label" for="password">密码
                    </label>
                    <input type="password" class="form-control" id="password"
                           name="password"
                           th:field="*{userPassword}" minlength=4
                           maxlength=50 required>
                    <div th:if="${#fields.hasErrors('userPassword')}">
                        <small class="form-text text-danger" th:errors=
                                "*{userPassword}">
                        </small>
                    </div>
                </div>
                <a class="btn btn-primary" th:href="@{/home}">返回首页</a>
                <button type="submit" class="btn btn-primary">用户注册
                </button>
            </form>
        </div>
    </div>
</div>
</body>
</html>